package java2;


import java.util.Arrays;
import java.util.Scanner;

class PersonOverride
{
	private String name;
	private int age;
	private boolean gender;
	public PersonOverride(String name,int age,boolean gender)
	{
		this.name=name;
		this.age=age;
		this.gender=gender;
	}
	public PersonOverride()
	{
		this("default",1,true);
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public boolean isGender() {
		return gender;
	}
	public void setGender(boolean gender) {
		this.gender = gender;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	@Override
	public String toString() {
		return "PersonOverride [name=" + name + ", age=" + age + ", gender=" + gender + "]";
	}
	public boolean equals(PersonOverride another)
	{
		 if (this == another)  return true;
	     if(another instanceof PersonOverride) 
	     {
	    	 if((this.name==another.name)&&(this.age==another.age)&&(this.gender==another.gender)) return true;
	    	 else return false;
	     }
	     else return false;
	}
}


public class java4_2 {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int i,t=0,w=0;
		int n1=in.nextInt();
		int n2=in.nextInt();
		PersonOverride[] person1=new PersonOverride[n1];
		PersonOverride[] person2=new PersonOverride[n2];
		for(i=0;i<n1;i++)
		{
			PersonOverride a=new PersonOverride();
		}
		for(i=0;i<n2;i++)
		{
			PersonOverride a=new PersonOverride(in.nextLine(),in.nextInt(),in.nextBoolean());
			for(int j=0;j<i;j++)
			{
				if(a.equals(person2[j])) t=1;
			}
			if(t==0) 
			{
				person2[i]=a;
				w++;
			}
			else if(t==1)
			{
				person2[i]=new PersonOverride();
			}
		}
		System.out.println(Arrays.deepToString(person1));
		System.out.println(Arrays.deepToString(person2));
		System.out.println(w);
		System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
	}

}
